package com.heima.utils.thread;

import com.heima.model.wemedia.pojos.WmUser;

/**
 * 自媒体端threadlocal工具类
 */
public class WmThreadLocalUtil {
    //定义一个threadlocal类
    private static  final  ThreadLocal<WmUser> WM_USER_THREAD_LOCAL=new ThreadLocal<>();
    //添加数据到threadlocal中
    public static  void setWmUser(WmUser wmUser){
        WM_USER_THREAD_LOCAL.set(wmUser);
    }
    //从threadlocal中获取元素
    public static  WmUser getWmUser(){
        return WM_USER_THREAD_LOCAL.get();
    }
    //清理threadlocal中的缓存数据
    public static void delWmUser(){
        WM_USER_THREAD_LOCAL.remove();
    }
}
